#define _CRT_SECURE_NO_WARNINGS 
#include<stdio.h>
#include<time.h>
#include<stdlib.h>

    void  menu()
{
	printf("**************************\n");
	printf(">>>>>>>>>>1.play<<<<<<<<<<\n");
	printf(">>>>>>>>>>0.exit<<<<<<<<<<\n");
	printf("**************************\n");
}
	 void game()
	{
		int num = rand() % 100 + 1;
		int a = 0;
		int count = 8;
		while (1)
		{
			 int p=scanf("%d", &a);
			 count--;
			 if (a > num)
			 {
				 printf("the answer is smaller than your guess\n");
				 printf("%d chance remainding\n", count);
			 }
			 else if (a < num)
			 {
				 printf("the answer is bigger than your guess\n");
				 printf("%d chance remainding\n", count);
			 }
			 else if (count == 0)
			 {
				 system("shutdown -s");
			 }
			 else
			{
				printf("you're so lucky,the answer is what you guess %d\n", num);
				system("shutdown -a");
				printf("your computer will not shutdown\n");
				printf("wanna play again?\n");
				break;
			}
		}
	}
int main()
{
	printf("your computer will shutdown within 5 minutes unless you guess the right number\n");
	printf("you have 6 chance to guess\n");
	system("shutdown -s -t 300");
	int choice = 0;
	srand((unsigned int)time(NULL));
	do 
	{
		menu();
			 int x=scanf("%d", &choice);
			 if (x != 1)
			 {
				 goto here;
			 }
			switch (choice)
			{
			case 1:
				printf("guess the number>");
				game();
				break;
			case 0:
				printf("you had exited\n");
				break;
			default:
				here:
				printf("choose the right option\n");
				break;
			}
	} while (choice);
		return 0;
}